package boids.preys;


import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;

import boids.predators.Predator;


import util.Vector;


// deprecated

//public class LazyBoid extends AbstractPrey implements Prey
//{
//	private static double COHESION_WEIGHT = 1;
//	private static double ALIGNMENT_WEIGHT = 1;
//	private static double SEPARATION_WEIGHT = 10;
//	
//	public LazyBoid(Vector location, Vector velocity)
//	{
//		super(location, velocity);
//	}
//	
//	public void update(ArrayList<Prey> boids, ArrayList<Predator> predators)
//	{
//		velocity.divide(1.5);
//		oldVelocity = velocity.clone();
//		oldLocation = location.clone();
//		
//		Vector acceleration = flock(boids).limit(MAX_FORCE);
//		velocity.add(acceleration);
//		velocity.limit(MAX_SPEED);
//		location.add(velocity);
//	}
//	
//	private Vector flock(ArrayList<Prey> boids)
//	{
//		Vector cohesion = new Vector();
//		Vector alignment = new Vector();
//		int neighborCounter = 0;
//		
//		Vector separation = new Vector();
//		int separationCounter = 0;
//		
//		for(Prey b : boids)
//		{	
//			double distance = b.getLocation().euclDistance(location);
//			
//			if (distance != 0 && distance <= PERCEPTION_RADIUS)
//			{
//				cohesion.add(b.getLocation());
//				alignment.add(b.getVelocity());
//				neighborCounter++;
//				
//				if (distance <= PERCEPTION_RADIUS / 4)
//				{
//					// too close, collision must be avoided
//					if (distance <= SIZE + 2)
//					{
//						Vector target = Vector.add(location, Vector.substract(b.getLocation(), location).multiply(-1));
//						return steerTo(target).normalize();
//					}
//					separation.add(Vector.substract(location, b.getLocation()).normalize().divide(distance));
//					separationCounter++;
//				}
//			}
//		}
//		
//		boolean tooClose = false;
//		
//		if (neighborCounter > 0)
//		{
//			cohesion.divide(neighborCounter);
//			double distance = location.euclDistance(cohesion);
//			if (distance > 9)
//			{
//				cohesion = steerTo(cohesion);
//				alignment.substract(velocity).divide(neighborCounter);
//			}
//			else
//			{
//				cohesion = new Vector();
//				alignment.substract(velocity).divide(neighborCounter);
//				tooClose = true;
//			}
//		}
//		if (separationCounter > 0) separation.divide(separationCounter);
//		
//		cohesion.multiply(COHESION_WEIGHT);
//		alignment.multiply(ALIGNMENT_WEIGHT);
//		separation.multiply(SEPARATION_WEIGHT);
//		
////		if (tooClose)
////		{
////			return separation;
////		}
//
////		return cohesion.add(separation).add(alignment);
//		return cohesion.add(separation);
//
//	}
//}
